home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / CLISRV / BOOKSALE / CLIENT / BOOK_CLI.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-12-06  |  20.2 KB  |  590 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "comctl32.ocx"
  3. Object = "{FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.0#0"; "ComCt232.Ocx"
  4. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "ComDlg32.OCX"
  5. Begin VB.Form frmRevenue 
  6.    Caption         =   "Book Revenue"
  7.    ClientHeight    =   5895
  8.    ClientLeft      =   2505
  9.    ClientTop       =   2415
  10.    ClientWidth     =   6840
  11.    ClipControls    =   0   'False
  12.    BeginProperty Font 
  13.       Name            =   "Tahoma"
  14.       Size            =   8.25
  15.       Charset         =   0
  16.       Weight          =   400
  17.       Underline       =   0   'False
  18.       Italic          =   0   'False
  19.       Strikethrough   =   0   'False
  20.    EndProperty
  21.    Icon            =   "BOOK_CLI.frx":0000
  22.    LinkTopic       =   "Form1"
  23.    PaletteMode     =   1  'UseZOrder
  24.    ScaleHeight     =   5895
  25.    ScaleWidth      =   6840
  26.    WhatsThisHelp   =   -1  'True
  27.    Begin VB.Frame Frame1 
  28.       Caption         =   "Revenue Parameters"
  29.       Height          =   2685
  30.       Left            =   80
  31.       TabIndex        =   4
  32.       Top             =   2250
  33.       Width           =   6660
  34.       Begin VB.CheckBox chkDiscount 
  35.          Caption         =   "Promotional Discount"
  36.          Height          =   270
  37.          Left            =   4080
  38.          TabIndex        =   8
  39.          Top             =   960
  40.          Width           =   1815
  41.       End
  42.       Begin VB.Frame Frame3 
  43.          BeginProperty Font 
  44.             Name            =   "MS Sans Serif"
  45.             Size            =   8.25
  46.             Charset         =   0
  47.             Weight          =   400
  48.             Underline       =   0   'False
  49.             Italic          =   0   'False
  50.             Strikethrough   =   0   'False
  51.          EndProperty
  52.          Height          =   1545
  53.          Left            =   3915
  54.          TabIndex        =   15
  55.          Top             =   990
  56.          Width           =   2595
  57.          Begin VB.TextBox txtRevParm 
  58.             Enabled         =   0   'False
  59.             Height          =   300
  60.             Index           =   5
  61.             Left            =   1755
  62.             TabIndex        =   10
  63.             Text            =   "3"
  64.             Top             =   690
  65.             Width           =   375
  66.          End
  67.          Begin VB.TextBox txtRevParm 
  68.             Enabled         =   0   'False
  69.             Height          =   300
  70.             Index           =   4
  71.             Left            =   1755
  72.             TabIndex        =   9
  73.             Text            =   "2"
  74.             Top             =   315
  75.             Width           =   375
  76.          End
  77.          Begin VB.TextBox txtRevParm 
  78.             Enabled         =   0   'False
  79.             Height          =   300
  80.             Index           =   6
  81.             Left            =   1755
  82.             TabIndex        =   11
  83.             Text            =   "15"
  84.             Top             =   1080
  85.             Width           =   375
  86.          End
  87.          Begin ComCtl2.UpDown udDiscount 
  88.             Height          =   255
  89.             Index           =   4
  90.             Left            =   2280
  91.             TabIndex        =   32
  92.             Top             =   360
  93.             Width           =   150
  94.             _ExtentX        =   423
  95.             _ExtentY        =   450
  96.             _Version        =   327680
  97.             Enabled         =   -1  'True
  98.          End
  99.          Begin ComCtl2.UpDown udDiscount 
  100.             Height          =   255
  101.             Index           =   5
  102.             Left            =   2280
  103.             TabIndex        =   33
  104.             Top             =   720
  105.             Width           =   150
  106.             _ExtentX        =   423
  107.             _ExtentY        =   450
  108.             _Version        =   327680
  109.             Enabled         =   -1  'True
  110.          End
  111.          Begin ComCtl2.UpDown udDiscount 
  112.             Height          =   255
  113.             Index           =   6
  114.             Left            =   2280
  115.             TabIndex        =   34
  116.             Top             =   1080
  117.             Width           =   150
  118.             _ExtentX        =   423
  119.             _ExtentY        =   450
  120.             _Version        =   327680
  121.             Enabled         =   -1  'True
  122.          End
  123.          Begin VB.Label Label2 
  124.             Alignment       =   1  'Right Justify
  125.             AutoSize        =   -1  'True
  126.             BackStyle       =   0  'Transparent
  127.             Caption         =   "Duration (months):"
  128.             Enabled         =   0   'False
  129.             Height          =   195
  130.             Index           =   5
  131.             Left            =   150
  132.             TabIndex        =   25
  133.             Top             =   720
  134.             Width           =   1485
  135.          End
  136.          Begin VB.Label Label2 
  137.             Alignment       =   1  'Right Justify
  138.             AutoSize        =   -1  'True
  139.             BackStyle       =   0  'Transparent
  140.             Caption         =   "Start Month:"
  141.             Enabled         =   0   'False
  142.             Height          =   195
  143.             Index           =   4
  144.             Left            =   480
  145.             TabIndex        =   24
  146.             Top             =   360
  147.             Width           =   1155
  148.          End
  149.          Begin VB.Label Label2 
  150.             Alignment       =   1  'Right Justify
  151.             BackStyle       =   0  'Transparent
  152.             Caption         =   "Discount %:"
  153.             Enabled         =   0   'False
  154.             Height          =   195
  155.             Index           =   6
  156.             Left            =   555
  157.             TabIndex        =   23
  158.             Top             =   1080
  159.             Width           =   1080
  160.          End
  161.       End
  162.       Begin VB.CommandButton cmdCogs 
  163.          Caption         =   "..."
  164.          Height          =   330
  165.          Left            =   3720
  166.          TabIndex        =   3
  167.          Top             =   390
  168.          Width           =   315
  169.       End
  170.       Begin VB.TextBox txtRevParm 
  171.          Height          =   300
  172.          Index           =   3
  173.          Left            =   2445
  174.          TabIndex        =   7
  175.          Text            =   "5000"
  176.          Top             =   2145
  177.          Width           =   1215
  178.       End
  179.       Begin VB.TextBox txtRevParm 
  180.          Height          =   300
  181.          Index           =   2
  182.          Left            =   2445
  183.          TabIndex        =   6
  184.          Text            =   "12"
  185.          Top             =   1590
  186.          Width           =   1215
  187.       End
  188.       Begin VB.TextBox txtRevParm 
  189.          Height          =   300
  190.          Index           =   1
  191.          Left            =   2445
  192.          TabIndex        =   5
  193.          Text            =   "10000"
  194.          Top             =   1020
  195.          Width           =   1215
  196.       End
  197.       Begin VB.TextBox txtRevParm 
  198.          Height          =   300
  199.          Index           =   0
  200.          Left            =   1440
  201.          TabIndex        =   16
  202.          TabStop         =   0   'False
  203.          Top             =   405
  204.          Width           =   2160
  205.       End
  206.       Begin VB.TextBox txtRevParm 
  207.          BeginProperty Font 
  208.             Name            =   "MS Sans Serif"
  209.             Size            =   8.25
  210.             Charset         =   0
  211.             Weight          =   400
  212.             Underline       =   0   'False
  213.             Italic          =   0   'False
  214.             Strikethrough   =   0   'False
  215.          EndProperty
  216.          Height          =   300
  217.          Index           =   7
  218.          Left            =   4215
  219.          TabIndex        =   28
  220.          TabStop         =   0   'False
  221.          Top             =   1245
  222.          Width           =   405
  223.       End
  224.       Begin VB.Label Label2 
  225.          Alignment       =   1  'Right Justify
  226.          AutoSize        =   -1  'True
  227.          BackStyle       =   0  'Transparent
  228.          Caption         =   "Units/Month :"
  229.          Height          =   195
  230.          Index           =   3
  231.          Left            =   270
  232.          TabIndex        =   22
  233.          Top             =   2190
  234.          Width           =   1815
  235.       End
  236.       Begin VB.Label Label2 
  237.          Alignment       =   1  'Right Justify
  238.          AutoSize        =   -1  'True
  239.          BackStyle       =   0  'Transparent
  240.          Caption         =   "Period (months):"
  241.          Height          =   195
  242.          Index           =   2
  243.          Left            =   285
  244.          TabIndex        =   21
  245.          Top             =   1620
  246.          Width           =   1800
  247.       End
  248.       Begin VB.Label Label2 
  249.          Alignment       =   1  'Right Justify
  250.          AutoSize        =   -1  'True
  251.          BackStyle       =   0  'Transparent
  252.          Caption         =   "Advertising Cost:"
  253.          Height          =   195
  254.          Index           =   1
  255.          Left            =   240
  256.          TabIndex        =   20
  257.          Top             =   1050
  258.          Width           =   1845
  259.       End
  260.       Begin VB.Label Label2 
  261.          Alignment       =   1  'Right Justify
  262.          AutoSize        =   -1  'True
  263.          BackStyle       =   0  'Transparent
  264.          Caption         =   "COGS Code:"
  265.          Height          =   195
  266.          Index           =   0
  267.          Left            =   330
  268.          TabIndex        =   19
  269.          Top             =   450
  270.          Width           =   1005
  271.       End
  272.       Begin VB.Label Label2 
  273.          AutoSize        =   -1  'True
  274.          BackStyle       =   0  'Transparent
  275.          Caption         =   "Author Royalty:"
  276.          BeginProperty Font 
  277.             Name            =   "MS Sans Serif"
  278.             Size            =   8.25
  279.             Charset         =   0
  280.             Weight          =   400
  281.             Underline       =   0   'False
  282.             Italic          =   0   'False
  283.             Strikethrough   =   0   'False
  284.          EndProperty
  285.          Height          =   240
  286.          Index           =   7
  287.          Left            =   4320
  288.          TabIndex        =   27
  289.          Top             =   1350
  290.          Width           =   1080
  291.       End
  292.    End
  293.    Begin VB.Frame frmSalesModel 
  294.       Caption         =   "Sales Model"
  295.       Height          =   1350
  296.       Left            =   80
  297.       TabIndex        =   2
  298.       Top             =   765
  299.       Width           =   6660
  300.       Begin VB.OptionButton optAnalysis 
  301.          Height          =   975
  302.          Index           =   2
  303.          Left            =   4920
  304.          Picture         =   "BOOK_CLI.frx":030A
  305.          Style           =   1  'Graphical
  306.          TabIndex        =   29
  307.          Top             =   240
  308.          Width           =   1575
  309.       End
  310.       Begin VB.OptionButton optAnalysis 
  311.          Height          =   975
  312.          Index           =   1
  313.          Left            =   2580
  314.          Picture         =   "BOOK_CLI.frx":166C
  315.          Style           =   1  'Graphical
  316.          TabIndex        =   30
  317.          Top             =   240
  318.          Width           =   1575
  319.       End
  320.       Begin VB.OptionButton optAnalysis 
  321.          Height          =   975
  322.          Index           =   0
  323.          Left            =   240
  324.          Picture         =   "BOOK_CLI.frx":29CE
  325.          Style           =   1  'Graphical
  326.          TabIndex        =   31
  327.          Top             =   240
  328.          Width           =   1575
  329.       End
  330.    End
  331.    Begin VB.CommandButton cmdClose 
  332.       Caption         =   "&Close"
  333.       Height          =   420
  334.       Left            =   5520
  335.       TabIndex        =   14
  336.       Top             =   5025
  337.       Width           =   1215
  338.    End
  339.    Begin VB.CommandButton cmdHelp 
  340.       Caption         =   "&Help"
  341.       Height          =   420
  342.       Left            =   120
  343.       TabIndex        =   13
  344.       Top             =   5040
  345.       Width           =   1215
  346.    End
  347.    Begin VB.CommandButton cmdExecute 
  348.       Caption         =   "Execute..."
  349.       Default         =   -1  'True
  350.       Height          =   420
  351.       Left            =   4080
  352.       TabIndex        =   12
  353.       Top             =   5040
  354.       Width           =   1215
  355.    End
  356.    Begin VB.ComboBox cboBooks 
  357.       Height          =   315
  358.       Left            =   2160
  359.       Sorted          =   -1  'True
  360.       TabIndex        =   1
  361.       Top             =   360
  362.       Width           =   4620
  363.    End
  364.    Begin VB.ComboBox cboAuthors 
  365.       Height          =   315
  366.       Left            =   80
  367.       Sorted          =   -1  'True
  368.       TabIndex        =   0
  369.       Top             =   360
  370.       Width           =   1980
  371.    End
  372.    Begin ComctlLib.StatusBar StatusBar1 
  373.       Align           =   2  'Align Bottom
  374.       Height          =   315
  375.       Left            =   0
  376.       TabIndex        =   26
  377.       Top             =   5580
  378.       Width           =   6840
  379.       _ExtentX        =   12065
  380.       _ExtentY        =   556
  381.       Style           =   1
  382.       SimpleText      =   ""
  383.       _Version        =   327680
  384.       BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
  385.          NumPanels       =   1
  386.          BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  387.             TextSave        =   ""
  388.             Object.Tag             =   ""
  389.          EndProperty
  390.       EndProperty
  391.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  392.          Name            =   "Tahoma"
  393.          Size            =   8.25
  394.          Charset         =   0
  395.          Weight          =   400
  396.          Underline       =   0   'False
  397.          Italic          =   0   'False
  398.          Strikethrough   =   0   'False
  399.       EndProperty
  400.    End
  401.    Begin MSComDlg.CommonDialog CommonDialog1 
  402.       Left            =   6600
  403.       Top             =   5520
  404.       _ExtentX        =   847
  405.       _ExtentY        =   847
  406.       _Version        =   327680
  407.       FontSize        =   1.73861e-39
  408.    End
  409.    Begin VB.Label Label1 
  410.       AutoSize        =   -1  'True
  411.       BackStyle       =   0  'Transparent
  412.       Caption         =   "Books:"
  413.       Height          =   195
  414.       Index           =   1
  415.       Left            =   2160
  416.       TabIndex        =   18
  417.       Top             =   135
  418.       Width           =   480
  419.    End
  420.    Begin VB.Label Label1 
  421.       AutoSize        =   -1  'True
  422.       BackStyle       =   0  'Transparent
  423.       Caption         =   "Author:"
  424.       Height          =   195
  425.       Index           =   0
  426.       Left            =   90
  427.       TabIndex        =   17
  428.       Top             =   135
  429.       Width           =   555
  430.    End
  431. Attribute VB_Name = "frmRevenue"
  432. Attribute VB_GlobalNameSpace = False
  433. Attribute VB_Creatable = False
  434. Attribute VB_PredeclaredId = True
  435. Attribute VB_Exposed = False
  436. Option Explicit
  437. Dim sSQL As String
  438. Private Sub cboAuthors_Click()
  439.   GetTitles cboAuthors.Text
  440. End Sub
  441. Sub GetAuthors()
  442.   Dim strSQL As String
  443.   Dim objAuthorField As Object
  444.   On Error GoTo GetAuthorsError
  445.   strSQL = "SELECT Authors.Author " & _
  446.                 "FROM Authors"
  447.   Set gSn = gDB.OpenRecordset(strSQL, dbOpenSnapshot, dbForwardOnly)
  448.   Set objAuthorField = gSn.Fields("author")
  449.   Do While Not gSn.EOF
  450.     cboAuthors.AddItem objAuthorField
  451.     gSn.MoveNext
  452.   Loop
  453.   gSn.Close
  454.   cboAuthors.ListIndex = 0
  455.   Exit Sub
  456. GetAuthorsError:
  457.     If IsObject(gSn) Then gSn.Close
  458.     Exit Sub
  459. End Sub
  460. Sub GetTitles(strAuthor As String)
  461. Dim strSQL As String
  462. Dim objTitlesField As Object
  463. On Error GoTo GetTitlesError
  464. strSQL = "SELECT Titles.Title " & _
  465.          "FROM Titles INNER JOIN (Authors INNER JOIN [Title Author] ON Authors.Au_ID = [Title Author].Au_ID) ON Titles.ISBN = [Title Author].ISBN " & _
  466.          "WHERE ((Authors.Author=" & Chr$(34) & strAuthor & Chr$(34) & "));"
  467. Set gSn = gDB.OpenRecordset(strSQL, dbOpenSnapshot, dbForwardOnly)
  468. cboBooks.Clear
  469. Set objTitlesField = gSn.Fields("Title")
  470. Do While Not gSn.EOF
  471.   cboBooks.AddItem objTitlesField
  472.   gSn.MoveNext
  473. gSn.Close
  474. cboBooks.ListIndex = 0
  475. Exit Sub
  476. GetTitlesError:
  477.   If Not gSn Is Nothing Then gSn.Close
  478.   Exit Sub
  479. End Sub
  480. Private Sub chkDiscount_Click()
  481.     Label2(4).Enabled = Not Label2(4).Enabled
  482.     Label2(5).Enabled = Not Label2(5).Enabled
  483.     Label2(6).Enabled = Not Label2(6).Enabled
  484.     txtRevParm(4).Enabled = Not txtRevParm(4).Enabled
  485.     txtRevParm(5).Enabled = Not txtRevParm(5).Enabled
  486.     txtRevParm(6).Enabled = Not txtRevParm(6).Enabled
  487.     udDiscount(4).Enabled = Not udDiscount(4).Enabled
  488.     udDiscount(5).Enabled = Not udDiscount(5).Enabled
  489.     udDiscount(6).Enabled = Not udDiscount(6).Enabled
  490. End Sub
  491. Private Sub cmdClose_Click()
  492.   Unload Me
  493. End Sub
  494. Private Sub cmdCogs_Click()
  495.   goStatusPanel.Text = "Determining Cost of Goods."
  496.   Load frmCogs
  497.   goStatusPanel.Text = ""
  498. End Sub
  499. Private Sub cmdHelp_Click()
  500. Dim sHelpString As String
  501.       
  502.     sHelpString = "1. Select an author and a book title." & vbCrLf & _
  503.                   "2. Select a Sales Model." & vbCrLf & _
  504.                   "3. Click the Select button to set the COGS price." & vbCrLf & _
  505.                   "4. Enter an amount to spend on Advertising Costs." & vbCrLf & _
  506.                   "5. Enter number of months in the Sales Period." & vbCrLf & _
  507.                   "6. Enter number of units sold per month." & vbCrLf & _
  508.                   "7. Optionally, click the Promotional Discount box to" & vbCrLf & _
  509.                   "    add a sales promotion for this book." & vbCrLf & _
  510.                   "8. Click the Show Chart button to display a chart of" & vbCrLf & _
  511.                   "    Publisher revenue and Author royalties."
  512.     MsgBox sHelpString, vbInformation, "Book Revenue Help"
  513. End Sub
  514. Private Sub cmdExecute_Click()
  515.   If cboBooks.Text = "<None>" Or cboBooks.Text = "" Then
  516.     MsgBox "Can not create a chart when there is no book title available.", _
  517.                   vbExclamation, "Create Chart Error"
  518.     Exit Sub
  519.   End If
  520.                          
  521.   goStatusPanel.Text = "Creating chart..."
  522.   Load frmChart
  523.   frmChart.Show
  524.       
  525. End Sub
  526. Private Sub Form_Load()
  527. Screen.MousePointer = vbHourglass
  528. Me.Show
  529. On Error GoTo LoadError
  530.   Set goStatusPanel = StatusBar1.Panels.Item(1)
  531.   Set gDB = Workspaces(0).OpenDatabase(gstrDBName, False, True)
  532.   goStatusPanel.Text = "Retrieving Authors Listing..."
  533.   GetAuthors
  534.   goStatusPanel.Text = "Connecting to remote rule..."
  535.   Set goBookSaleSvrInst = CreateObject("BookSaleSvr.Sales")
  536.   goStatusPanel.Text = "Remote Connection Successful..."
  537. LoadExit:
  538. Screen.MousePointer = vbDefault
  539. Exit Sub
  540. LoadError:
  541.   'advanced error handling is required if the database cannot be
  542.   'found as error 3024 would indicate.
  543.   If Err = 3024 Then
  544.       'set CommonDialog properties before showing
  545.       With CommonDialog1
  546.         .DialogTitle = "Unable to find the booksale.mdb file location"
  547.         .Filter = "(*.mdb)|*.mdb"
  548.         .InitDir = CurDir
  549.         .filename = ""
  550.         .Flags = cdlOFNExplorer Or cdlOFNFileMustExist Or cdlOFNPathMustExist
  551.         .ShowOpen
  552.         'make sure the filename is not an empty string
  553.         If .filename <> "" Then
  554.           'make sure that the database file returned is indeed biblio.mdb
  555.           If Right(UCase(.filename), Len("booksale.mdb")) = "BOOKSALE.MDB" Then
  556.             gstrDBName = .filename
  557.           End If
  558.           Resume
  559.         Else
  560.           Unload Me
  561.         End If
  562.       End With
  563.   ElseIf Err <> 0 Then ' another error
  564.       MsgBox Error$ & " - " & Str$(Err), vbExclamation, "Form_Load Error"
  565.       End
  566.   End If
  567.   Resume LoadExit
  568. End Sub
  569. Private Sub Form_Unload(Cancel As Integer)
  570.   Set gSn = Nothing
  571.   Set goBookSaleSvrInst = Nothing
  572. End Sub
  573. Private Sub optAnalysis_Click(Index As Integer)
  574.   frmSalesModel.Tag = Index
  575. End Sub
  576. Private Sub txtRevParm_GotFocus(Index As Integer)
  577.   txtRevParm(Index).SelStart = 0
  578.   txtRevParm(Index).SelLength = Len(txtRevParm(Index).Text)
  579. End Sub
  580. Private Sub udDiscount_DownClick(Index As Integer)
  581.   If Val(txtRevParm(Index).Text) > 1 Then
  582.     txtRevParm(Index).Text = Val(txtRevParm(Index).Text) - 1
  583.   End If
  584. End Sub
  585. Private Sub udDiscount_UpClick(Index As Integer)
  586.   If Val(txtRevParm(Index).Text) < 99 Then
  587.     txtRevParm(Index).Text = Val(txtRevParm(Index).Text) + 1
  588.   End If
  589. End Sub
  590.